<template>
  <div id="scroll-board2">
    <div class="center-board-title">
      3年以上未使用空编的部门（单位）
      <el-select v-model="value" @change="changeVal" placeholder="请选择">
        <el-option
          v-for="item in options"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option>
      </el-select>
    </div>
    <el-table
      :data="tableData"
      :height="250"
      :highlight-current-row="false"
      :header-cell-style="{
        color: '#fff',
        background: '#333',
        fontWeight: '700'
      }"
      :row-class-name="tableRowClassName"
    >
      <el-table-column label="序号" prop="index" width="60" align="center">
        <template slot-scope="scope">
          <span>{{ scope.$index + 1 }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="date" label="日期" width="120"> </el-table-column>
      <el-table-column prop="name" label="姓名" width="120"> </el-table-column>
      <el-table-column prop="address" label="地址"> </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  name: 'ScrollBoard2',
  data() {
    return {
      options: [
        {
          value: 'xzjg',
          label: '行政机关'
        },
        {
          value: 'sydw',
          label: '事业单位'
        }
      ],
      value: '',

      tableData: [
        {
          date: '2016-05-02',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1518 弄'
        },
        {
          date: '2016-05-04',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1517 弄'
        },
        {
          date: '2016-05-01',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1519 弄'
        },
        {
          date: '2016-05-03',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1516 弄'
        },
        {
          date: '2016-05-03',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1516 弄'
        },
        {
          date: '2016-05-03',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1516 弄'
        }
      ]
    }
  },
  methods: {
    // 表格斑马格:row-class-name="tableRowClassName"
    tableRowClassName({ row, rowIndex }) {
      if (rowIndex % 2 == 0) {
        return ''
      } else {
        return 'warning-row'
      }
    },
    // 行点击事件
    handleClickChange(row, event, column) {
      console.log('点击行', row.index, this.myChart, row, column, row.active)
    }
  }
}
</script>

<style lang="scss">
#scroll-board2 {
  width: calc(40% - 15px);
  height: 100%;
  box-sizing: border-box;
  background-color: rgba(1, 35, 102, 0.9);
  //background-color: #012366;
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;

  .center-board-title {
    border-bottom: #336699 1px solid;
    height: 50px;
    line-height: 50px;
    text-align: center;
    font-weight: bold;
    font-size: 18px;

    .el-select {
      width: 160px;
      margin-left: 30px;
      .el-input--suffix {
        > input {
          background-color: #133596;
          color: #83a8f4;
          border: 1px solid #83a8f4;
          border-radius: 16px;
          height: 32px;
        }
        .el-select__caret {
          font-size: 14px;
        }
        .el-input__icon {
          line-height: 32px;
        }
      }
    }
  }

  // 表格部分样式
  // 最外层透明
  .el-table,
  .el-table__expanded-cell {
    background-color: transparent;
    color: #93dcfe;
    font-size: 14px;
  }

  // 表格内背景颜色
  .el-table th,
  .el-table tr,
  .el-table td {
    background-color: transparent;
    border: 0px;
    color: #93dcfe;
    font-size: 14px;
    height: 5px;
    font-family: Source Han Sans CN Normal, Source Han Sans CN Normal-Normal;
    font-weight: Normal;
  }

  // 去掉最下面的那一条线
  .el-table::before {
    height: 0px;
  }

  // 设置表格行高度
  .el-table__body tr,
  .el-table__body td {
    padding: 0;
    height: 54px;
  }

  .el-table__header th{
    background-color: #1981f6 !important;
  }

  // 修改高亮当前行颜色
  .el-table tbody tr:hover > td {
    background: #063570 !important;
  }

  // 取消当前行高亮
  //  .el-table tbody tr {
  //   pointer-events: none;
  // }

  // 修改表头样式-加边框
  .el-table__header-wrapper {
    border: solid 1px #04c2ed;
    // box-sizing: border-box;
  }

  // 表格斑马自定义颜色
  .el-table__row.warning-row {
    background: #063570;
  }

  // 滚动条样式
  .el-table__body-wrapper::-webkit-scrollbar-track {
    background-color: #063570;
  }

  .el-table__body-wrapper::-webkit-scrollbar {
    width: 10px;
    opacity: 0.5;
  }

  .el-table__body-wrapper::-webkit-scrollbar-thumb {
    border-radius: 15px;
    background-color: #0257aa;
  }
}
</style>
